﻿using Jay.Sc2.Bof.Lib.State;

namespace Jay.Sc2.Bof.Lib.Action.Zerg
{
	public class ActionProduceCorruptor : ActionProduceFromLarva
	{
		public static ActionProduceCorruptor Instance = new ActionProduceCorruptor();
		private ActionProduceCorruptor() : base(40, 150, 100, 2) { }
		public override bool HaveTechnology(IBuildOrder bo)
		{
			ZergState state = bo.State as ZergState;
			return state.Spire.Count + state.GreaterSpire.Total > 0;
		}
		public override void OnProductionStarted(IBuildOrder bo)
		{
			ZergState state = bo.State as ZergState;
			state.Corruptor_Building++;
		}
		public override void OnProductionFinished(IBuildOrder bo)
		{
			ZergState state = bo.State as ZergState;
			state.Corruptor_Building--;
			state.Corruptor++;
		}
		public override string EventName { get { return "ActionSpawnCorruptor"; } }
		public override bool IsInvalid(Jay.Sc2.Bof.Lib.State.IBuildOrder bo)
		{
			ZergState state = bo.State as ZergState;
			return base.IsInvalid(bo) || state.Spire.Total + state.GreaterSpire.Total == 0;
		}
		private IAction[,] m_Requirements;
		public override IAction[,] Requirements
		{
			get
			{
				if (m_Requirements == null)
					m_Requirements = new IAction[,] { { ActionProduceSpire.Instance } };
				return m_Requirements;
			}
		}
	}
}
